//
// Created by win10 on 24-12-4.
//
#include <stdio.h>
#include <stdlib.h>
typedef char ElemType;
typedef  struct  BiNode
{  ElemType  data;
    struct  BiNode   *lchild,*rchild;
}BiNode,*BiTree;
//2.创建新节点
BiTree createLtree() {
    BiTree T;
    char x;
    scanf("%c",&x);
    if(x=='#') return NULL;
    if(x=='\n') return T;
    else{
        T=(BiTree)malloc(sizeof(BiNode));
        T->data=x;
        T->lchild=createLtree();
        T->rchild=createLtree();
        return T;
    }
}
//后序遍历
void lastorder(BiTree T) {
    //设置出口
    if(T==NULL) {
        return;
    }
    //按照优先级 先对左子树遍历
    lastorder(T->lchild);
    //在对右子树遍历
    lastorder(T->rchild);
    //最后输出节点
    printf("%c",T->data);
}
int main() {
    BiTree T;
    T=createLtree();
    lastorder(T);
    return 0;
}